package gc3d.gridspring;

import gc3d.database.DBSettings;
import gc3d.database.GridPovDB;
import gc3d.ftp.FTPSettings;
import gc3d.ftp.GridPovFTP;
import gc3d.griddata.GridData;
import gc3d.griddata.GridPovData;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.SQLException;


/**
 * @author Pierrick
 *
 */
public class GridTestZip {

	public static void main(String[] args) {
		System.out.println("main test gridpovrun start:");


		try {
			File zip = new File("doc/jan-pov-project.zip");
			FileInputStream fis = new FileInputStream(zip);
			byte data[] = new byte[(int)zip.length()];
			fis.read(data);

			GridPovData gpd   = new GridPovData(100, 100, 10, 0, 1, false, 0.1, 2, "jan-gridtest.zip", data);
			GridPovFTP  gpftp = new GridPovFTP(FTPSettings.getFTPhost(), FTPSettings.getFTPport(), FTPSettings.getFTPuser(), FTPSettings.getFTPpass());
			GridPovDB   gpdb  = new GridPovDB(DBSettings.getDBURL(),DBSettings.getDBuser(),DBSettings.getDBpass());
			GridData    gd    = new GridData(gpd, gpftp, gpdb, data);
			GridPovRun  gpr   = new GridPovRun(gd, 5, 800);
			gpr.start();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		System.out.println("main test gridpovrun finished.");
	}
}
